package com.cl.blog.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.Date;
import java.util.List;

import lombok.Data;

/**
 * @TableName b_content_review
 */
@TableName(value = "b_content_review")
@Data
public class BContentReview implements Serializable {
	/**
	 *
	 */
	@TableId(type = IdType.AUTO)
	private Integer id;

	/**
	 *
	 */
	private Integer userId;

	/**
	 * 父级评论
	 */
	private Integer parentId;

	/**
	 *
	 */
	private LocalDateTime createTime;
	private Integer contentId;

	/**
	 *
	 */
	private Long likeCount;

	/**
	 * 评论内容
	 */
	private String reviewContent;

	@TableField(exist = false)
	private BContent bContent;

	// 评论的用户
	@TableField(exist = false)
	private BUser bUser;

	// 子级评论
	@TableField(exist = false)
	private List<BContentReview> list;

	@TableField(exist = false)
	private static final long serialVersionUID = 1L;

	@Override
	public boolean equals(Object that) {
		if (this == that) {
			return true;
		}
		if (that == null) {
			return false;
		}
		if (getClass() != that.getClass()) {
			return false;
		}
		BContentReview other = (BContentReview) that;
		return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
				&& (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
				&& (this.getParentId() == null ? other.getParentId() == null : this.getParentId().equals(other.getParentId()))
				&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
				&& (this.getLikeCount() == null ? other.getLikeCount() == null : this.getLikeCount().equals(other.getLikeCount()))
				&& (this.getReviewContent() == null ? other.getReviewContent() == null : this.getReviewContent().equals(other.getReviewContent()));
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
		result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
		result = prime * result + ((getParentId() == null) ? 0 : getParentId().hashCode());
		result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
		result = prime * result + ((getLikeCount() == null) ? 0 : getLikeCount().hashCode());
		result = prime * result + ((getReviewContent() == null) ? 0 : getReviewContent().hashCode());
		;
		return result;
	}

	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append(getClass().getSimpleName());
		sb.append(" [");
		sb.append("Hash = ").append(hashCode());
		sb.append(", id=").append(id);
		sb.append(", userId=").append(userId);
		sb.append(", parentId=").append(parentId);
		sb.append(", createTime=").append(createTime);
		sb.append(", likeCount=").append(likeCount);
		sb.append(", reviewContent=").append(reviewContent);
		sb.append(", serialVersionUID=").append(serialVersionUID);
		sb.append("]");
		return sb.toString();
	}
}